<div>
    <fieldset>
        <legend>Новый заказ</legend>

        <div class="PageMenu">
            <button id="GoToCatalog">Перейти к каталогу</button>
            <button id="GoToSearch">Перейти к поиску</button>
            <button id="SendOrder">Заказать</button>
        </div>

        <div class="PageContent" id="SelItemsTableDiv">
            <?php echo $this->GetSelItemsTable()->ToHtml(); ?>
        </div>
    </fieldset>

    <script type="text/javascript" id="AddOrderScript">
        jsun.run(function() {
        ///////////////////////////////////////////////
            jsun("#GoToSearch").jsun.event({ onclick: GoToSearch });
            jsun("#GoToCatalog").jsun.event({ onclick: GoToCatalog });
            jsun("#SendOrder").jsun.event({ onclick: SendOrder });

            function GoToSearch() {
                window.location = "?u=Index&p=Index\\Search";
            }

            function GoToCatalog() {
                window.location = "?u=Index&p=Index\\Catalog";
            }

            function SendOrder() {

                if (jsun("#SelItemsTable").firstChild.childNodes.length == 1) {
                    jsun.dialog.warning("Ошибка", "Список пуст").show();
                    return true;
                }

                //jsun.ajax.simple_request

                return jsun.dialog.confirm("Отправка заказа",
                    "Заказать выбранные издания?",
                    function() {
                        jsun.ajax.send_request({ param: "u=Reader/SendOrder", asyn: false });

                        jsun.run(function(){
                            window.location = '?u=Index&p=Reader\\Order';
                        });

                        jsun.dialog.active.close();
                    }).show();
            }
        ///////////////////////////////////////////////
        });
    </script>
</div>